package com.zmn.mcc.permit.client.aop;

import com.zmn.base.common.data.dubbo.interfaces.company.CompanyListRemoteService;
import com.zmn.gateway.dubbo.client.GUserHolder;
import com.zmn.mcc.common.dto.staff.LoginStaffDO;
import com.zmn.mcc.dubbo.interfaces.staff.StaffPermitRemoteService;
import com.zmn.mcc.permit.client.consts.PermitAspectTypeConsts;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.core.annotation.Order;

/**
 * dubbo 层切面
 *
 * @author LuJia
 * @version v1.0
 * @since 2020/06/17 17:17
 **/
@Aspect
@Order(1)
@Slf4j
public class AliDubboPermitDataAspect extends BasePermitProcess {

    /**
     * 设定切入点
     */
    @Override
    @Pointcut("@annotation(com.zmn.mcc.permit.client.annotation.FilterPermitData) && @within(com.alibaba.dubbo.config.annotation.Service)")
    protected void pointCutMethod() {
    }
    @Override
    protected LoginStaffDO getLoginStaffDO() {
        return GUserHolder.getCurrentLoginStaff();
    }

    @Override
    protected Integer getAspectType() {
        return PermitAspectTypeConsts.DUBBO;
    }

    public AliDubboPermitDataAspect(StaffPermitRemoteService staffPermitRemoteService, CompanyListRemoteService baseCompanyListRemoteService) {
        this.staffPermitRemoteService = staffPermitRemoteService;
        this.companyListRemoteService = baseCompanyListRemoteService;
    }

}
